package com.mycat.manager.controller.help;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 页面组件提示
 * 
 * @author Roger
 */
@Controller
@RequestMapping("help")
public class PageController {

	private static final Logger logger = LoggerFactory
			.getLogger(PageController.class);

	/**
	 * 关闭UL组件
	 */
	private static final String closeMenu = "N";

	/**
	 * 打开UL组件
	 */
	private String openMenu = "Y_UI";

	/**
	 * 页面跳转之提取后的头部、左侧、右侧设置
	 */
	@RequestMapping("toBase")
	public String toBase() {
		logger.info("页面跳转之提取后的头部、左侧、右侧设置");
		return "base";
	}

	/**
	 * 页面跳转之控制台
	 */
	@RequestMapping("toIndex")
	public String toIndex(Model model) {
		model.addAttribute("active", "index");
		model.addAttribute("isOpenMenu", closeMenu);
		logger.info("页面跳转之控制台");
		return "help/index";
	}

	/**
	 * 页面跳转之文字排版
	 */
	@RequestMapping("toTypography")
	public String toTypography(Model model) {
		model.addAttribute("active", "typography");
		model.addAttribute("isOpenMenu", closeMenu);
		logger.info("页面跳转之文字排版");
		return "help/typography";
	}

	/**
	 * 页面跳转之UI组件-组件
	 */
	@RequestMapping("toElements")
	public String toElements(Model model) {
		openMenu = "Y_UI";
		model.addAttribute("active", "elements");
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之UI组件-组件");
		return "help/elements";
	}

	/**
	 * 页面跳转之UI组件-按钮&图标
	 */
	@RequestMapping("toButtons")
	public String toButtons(Model model) {
		openMenu = "Y_UI";
		model.addAttribute("active", "buttons");
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之UI组件-按钮&图标");
		return "help/buttons";
	}

	/**
	 * 页面跳转之UI组件-树形菜单
	 */
	@RequestMapping("toTreeview")
	public String toTreeview(Model model) {
		openMenu = "Y_UI";
		model.addAttribute("active", "treeview");
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之UI组件-树形菜单");
		return "help/treeview";
	}

	/**
	 * 页面跳转之UI组件-jQuery UI
	 */
	@RequestMapping("tojQueryUI")
	public String tojQueryUI(Model model) {
		openMenu = "Y_UI";
		model.addAttribute("active", "jQueryUI");
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之UI组件-jQuery UI");
		return "help/jquery-ui";
	}

	/**
	 * 页面跳转之UI组件-可拖拽面板
	 */
	@RequestMapping("toNestableList")
	public String toNestableList(Model model) {
		openMenu = "Y_UI";
		model.addAttribute("active", "nestableList");
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之UI组件-可拖拽面板");
		return "help/nestable-list";
	}

	/**
	 * 页面跳转之表格-简单&动态
	 */
	@RequestMapping("toTables")
	public String toTables(Model model) {
		model.addAttribute("active", "tables");
		openMenu = "Y_Tables";
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之表格-简单&动态");
		return "help/tables";
	}

	/**
	 * 页面跳转之表格-简单&动态
	 */
	@RequestMapping("toJqgrid")
	public String toJqgrid(Model model) {
		model.addAttribute("active", "jqgrid");
		openMenu = "Y_Tables";
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之表格-简单&动态");
		return "help/jqgrid";
	}

	/**
	 * 页面跳转之表格-简单&动态
	 */
	@RequestMapping("toJqgrid1")
	public String toJqgrid1(Model model) {
		model.addAttribute("active", "jqgrid");
		openMenu = "Y_Tables";
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之表格-简单&动态");
		return "help/jqgrid1";
	}

	/**
	 * 页面跳转之表单-表单组件
	 */
	@RequestMapping("ToformElements")
	public String ToformElements(Model model) {
		model.addAttribute("active", "formElements");
		openMenu = "Y_Form";
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之表单-表单组件");
		return "help/formElements";
	}

	/**
	 * 页面跳转之表单-表单组件
	 */
	@RequestMapping("ToformWizard")
	public String ToformWizard(Model model) {
		model.addAttribute("active", "formWizard");
		openMenu = "Y_Form";
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之表单-表单组件");
		return "help/formWizard";
	}

	/**
	 * 页面跳转之表单-编辑器
	 */
	@RequestMapping("toWysiwyg")
	public String toWysiwyg(Model model) {
		model.addAttribute("active", "wysiwyg");
		openMenu = "Y_Form";
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之表单-编辑器");
		return "help/wysiwyg";
	}

	/**
	 * 页面跳转之表单-文件上传
	 */
	@RequestMapping("toDropzone")
	public String toDropzone(Model model) {
		model.addAttribute("active", "dropzone");
		openMenu = "Y_Form";
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之表单-文件上传");
		return "help/dropzone";
	}

	/**
	 * 页面跳转-插件
	 */
	@RequestMapping("toWidgets")
	public String toWidgets(Model model) {
		model.addAttribute("active", "widgets");
		model.addAttribute("isOpenMenu", closeMenu);
		logger.info("页面跳转-插件");
		return "help/widgets";
	}

	/**
	 * 页面跳转-日历
	 */
	@RequestMapping("toCalendar")
	public String toCalendar(Model model) {
		model.addAttribute("active", "calendar");
		model.addAttribute("isOpenMenu", closeMenu);
		logger.info("页面跳转-日历");
		return "help/calendar";
	}

	/**
	 * 页面跳转-相册
	 */
	@RequestMapping("toGallery")
	public String toGallery(Model model) {
		model.addAttribute("active", "gallery");
		model.addAttribute("isOpenMenu", closeMenu);
		logger.info("页面跳转-相册");
		return "help/gallery";
	}

	/**
	 * 页面跳转之其它页面-空白页面
	 */
	@RequestMapping("toBlank")
	public String toBlank(Model model) {
		model.addAttribute("active", "blank");
		openMenu = "Y_other";
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之其它页面-空白页面");
		return "help/blank";
	}

	/**
	 * 页面跳转之其它页面-404
	 */
	@RequestMapping("toError404")
	public String toError404(Model model) {
		model.addAttribute("active", "error404");
		openMenu = "Y_other";
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之其它页面-404");
		return "help/error_404";
	}

	/**
	 * 页面跳转之其它页面-500
	 */
	@RequestMapping("toError500")
	public String toError500(Model model) {
		model.addAttribute("active", "error500");
		openMenu = "Y_other";
		model.addAttribute("isOpenMenu", openMenu);
		logger.info("页面跳转之其它页面-500");
		return "help/error_500";
	}

}
